import { pubRequire } from '@utils/public'
const baseUrl = '/reads/permissions'

//列表
export function getPowerList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}`, obj, callbBack, errBack)
}
//新增-用户列表
export function getAddList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/validations`, obj, callbBack, errBack)
}
//新增
export function addUser(obj, callbBack, errBack) {
  return pubRequire('post', `${baseUrl}`, obj, callbBack, errBack)
}
//删除
export function deleteSingleRequest(obj, callbBack, errBack) {
  return pubRequire('delete', `${baseUrl}`, obj, callbBack, errBack)
}
//批量删除
export function deleteMultRequest(obj, callbBack, errBack) {
  return pubRequire('delete', `${baseUrl}/batch`, obj, callbBack, errBack)
}
//开启
export function open(userId, obj, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${userId}/enabled`,
    obj,
    callbBack,
    errBack
  )
}
//关闭
export function close(userId, obj, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${userId}/disabled`,
    obj,
    callbBack,
    errBack
  )
}
//导入接口
export function importUrl() {
  return `${baseUrl}/accesses/import?permCode=PUBLISH_READING`
}
//导出接口
export function exportUrl() {
  return `${baseUrl}/export`
}
//下载模板接口
export function downUrl() {
  return `${baseUrl}/download`
}
